package com.witmed.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * 超级管理员daoImpl
 * chenxiangyang
 */
import com.witmed.dao.SuperAdminDao;
import com.witmed.entity.SuperAdmin;
import com.witmed.util.DBUtils;

public class SuperAdminDaoImpl implements SuperAdminDao {

	private DBUtils db = new DBUtils();

	@Override
	public List<SuperAdmin> findByNameAndPassword(String adminPassword) {

		List<SuperAdmin> list = new ArrayList<SuperAdmin>();
		ResultSet rs = db.query("select admin_password from super_admin where admin_password=?",
				adminPassword);
		try {
			while (rs.next()) {
				adminPassword = rs.getString("admin_password");
				SuperAdmin admin = new SuperAdmin(null, adminPassword);
				list.add(admin);

			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return list;

	}

}
